<?php
    //echo '<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.php">';
    //exit();
    $top_menu_1 = FALSE;
    $top_menu_2 = FALSE;
    $top_menu_3 = FALSE;
    $top_menu_4 = FALSE;
    $top_menu_5 = FALSE;
    $top_menu_6 = FALSE;
    $top_menu_7 = FALSE;
    include('header.php');
    include('sidebar2.php');
?>
            <div id="main_content" class="register_content">
                <img src="images/forgot_pass_title.jpg" alt="Forgot Password" id="register_title" />
                
                <form name="regis_frm" id="regis_frm" <?php if(isset($_SESSION['m_id'])){ echo 'class="display_none"'; } ?>>
                
                <div class="regis_frm">
                    <span>Email Address :</span>
                    <input type="text" name="email" id="email" /> *
                </div>
                
                </form>
                
                <div class="regis_frm <?php if(isset($_SESSION['m_id'])){ echo 'display_none'; } ?>">
                    <span>&nbsp;</span>
                    <img src="images/register_submit_bt.jpg" alt="submit" id="register_submit_bt" class="img_link"/>
                    <img src="images/ajax-loader.gif" alt="submit" id="ajax_loader" class="display_none" />
                </div>
                
                
                <div id="success_msg" class="display_none">
                <?php echo $status_msg['forget_pass']; ?>
                </div>
                
                <div id="success_msg2" class="<?php if(!isset($_SESSION['m_id'])){ echo 'display_none'; } ?>">
                <?php
                    echo $status_msg['allready_login'];
                    //redirect('index.php');
                ?>
                </div>
            </div>
            <div class="clear">&nbsp;</div>
<?php
    include('footer.php');
?>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script>
    $(function() {
        $("#regis_frm").validate({
            rules: {
                email: {
                    required: true,
                    email: true
                }
            },
            messages: {
                email: {
                    required: "Please enter an email address",
                    email: "Please enter a valid email address"
                }
            }
        });
        
        $('#register_submit_bt').click(function(){
            if($("#regis_frm").valid()){
                $("#register_submit_bt").css('display','none');
                $("#ajax_loader").css('display','block');
                var str = $("#regis_frm").serialize();
                $.post("function/forget_password.php", str ,function(data){
                    if(trim(data)=='success'){
                        $("#regis_frm , .regis_frm").css('display','none');
                        $("#success_msg").css('display','block');
                        //setInterval("window.location='?page=press_room';",5000);
                    }else{
                        alert(data);
                        $("#register_submit_bt").css('display','block');
                        $("#ajax_loader").css('display','none');
                        $("#email").focus();
                    }
                });
            }
        });
    });
</script>